Repository navigation
Fix followup formatting: preserve HTML in responses, strip from clipboard - #84452
Conversation
…wups from clipboard Bug 2 (frontend): Strip <followup-list> from HTML before copying to clipboard so followup questions and pre-generated responses do not leak into Copy message. Bug 3: Use getInnerHTML instead of textContent when parsing followup-response elements so bullet lists and other HTML formatting are preserved. Issue: Expensify/Expensify#608799 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
getInnerHTML from domutils is deprecated; use the dom-serializer module directly as recommended. The > character is no longer entity-encoded in text content, which is valid HTML — update the test expectation to match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@mananjadhav What is your ETA? |
| const followupTextElement = DomUtils.getElementsByTagName('followup-text', followupEl, true).at(0); | ||
| const followupResponseElement = DomUtils.getElementsByTagName('followup-response', followupEl, true).at(0); | ||
| const text = followupTextElement ? DomUtils.textContent(followupTextElement) : ''; | ||
| const response = followupResponseElement ? DomUtils.textContent(followupResponseElement) : undefined; |
There was a problem hiding this comment.
question: @marcochavezf the only thing I want to highlight is this will ensure that it'll return HTML for all the strings. I know it's already mentioned in the PR body
There was a problem hiding this comment.
Yup, it's intentional, so now formatted responses from follow-ups (bold, lists, links from the help center) are preserved when displayed
Screenshots/VideosAndroid: HybridAppandroid-html-copy-response.movAndroid: mWeb Chromemweb-chrome-html-copy-response.moviOS: HybridAppiOS: mWeb Safarimweb-safari-html-copy-response.movMacOS: Chrome / Safariweb-copy-html-response.mov |
Reviewer Checklist
|
mananjadhav
left a comment
There was a problem hiding this comment.
Have trouble with iOS but the change isn't native. Works fine on all the other platforms. One question I highlighted to confirm expectations.
|
🎯 @mananjadhav, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #84830. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @dangrous has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/dangrous in version: 9.3.36-0 🚀
|
|
Passed, Chrome / 9.3.36-6 Screen.Recording.2026-03-12.at.15.44.25.mp4 |
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.36-10 🚀
|
|
Yes @mallenexpensify. I just went through the PR history and found the issue. Sorry for the unnecessary tag. |
Explanation of Change
Fixes two of three formatting bugs with Concierge suggested followup buttons (companion to the Auth PR):
Bug 2 -- Followup data leaks into "Copy message": The catch-all clipboard handler in
ContextMenuActions.tsxwas passing raw HTML (including custom<followup-list>elements) throughParser.htmlToText, which does not know about these custom elements and renders their text content into the clipboard. Added astripFollowupListFromHtmlcall before the clipboard copy so followup questions and pre-generated responses are removed.Bug 3 -- Bullet lists collapsed in pre-generated responses:
parseFollowupsFromHtmlwas usingDomUtils.textContentto extract<followup-response>content, which strips all HTML tags. Bullet lists, bold text, etc. were flattened into a single unformatted string. Changed torender(fromdom-serializer) which preserves the HTML structure, allowing the response to render correctly when displayed as a Concierge message.Data Flow
Clipboard copy pipeline (Bug 2):
Without the strip step,
Parser.htmlToTextdoes not recognize the custom<followup-list>/<followup-text>/<followup-response>elements, so their text content (followup questions and pre-generated answers) leaks into the pasted text.Followup response rendering pipeline (Bug 3):
DomUtils.textContentis correct for<followup-text>(plain button label), but<followup-response>contains rich HTML that must survive the extraction.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/608799
PROPOSAL:
Tests
Offline tests
N/A -- followup buttons require an active Concierge connection. The clipboard stripping and HTML parsing are purely client-side transformations that work identically offline.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari